<include file="Index/_meta" />
<body>
<style type="text/css">
.layui-input-inline{
    width: 60%;
}
.myul a{
    padding-left: 20px;
    font-size: 18px;
    color: #aaa;
}
li{
    padding-top: 36px;
}
</style>
<div class="q_right">
    <div class="mg101">
        <div class="query-xucha">
            <div class="layui-input-inline">
                <input type="text" id="skeyword" autocomplete="off" value="{$query_keywords}" placeholder="请输入查询条件" class="layui-input">
            </div>
            <button class="layui-btn btn-primary mgl-20" id="chaxunanniu">查询</button>
        </div>
        <div class="list_content">
            <div class="labeltiao">
                <ul class="myul">
                    
                    <?php foreach($biaoqian as $v) {?>
                    <li class="myli">
                        <a href="javascript:;" class="<?php echo $v[1]?>" ><?php echo $v[0]?></a>
                    </li>
                    <?php }?>

                </ul>
            </div> 
            <div class="result_list">
                <div class="query_result" id="query_result">
                    <table class="layui-table">
                        <colgroup>
                            <col width="150">
                            <col width="60">
                            <col width="106">
                            <col width="175">
                            <col width="60">
                            <col width="88">
                            <col width="160">
                            <col width="94">
                        </colgroup>
                        <thead style="width:100%;">
                            <tr>
                                <th>姓名</th>
                                <th>性别</th>
                                <th>出生日期</th>
                                <th>身份证号</th>
                                <th>民族</th>
                                <th>婚姻状况</th>
                                <th>是否重点人</th>
                                <th>详情</th>
                            </tr>
                        </thead>
                        <tbody style="width:100%;">
                            <volist name="ren" id="data">
                                <tr>
                                    <td>
                                        {$data.name}
                                    </td>
                                    <td class="sex">
                                        {$data.sex}
                                    </td>
                                    <td>
                                        {$data.date}
                                    </td>
                                    <td>
                                        {$data.idcard}
                                    </td>
                                    <td>
                                        {$data.minzu}
                                    </td>
                                    <td style="text-align: center;">
                                        {$data.hunyin}
                                    </td>
                                    <td class="zhongdian" style="text-align: center;">
                                        {$data.is_zhongdian}
                                    </td>
                                    <td>
                                        <button class="layui-btn layui-btn-sm btn-primary" style="color: white;"  onclick="xiangqing(this)" peopleId="{$data.id}" id="{$data.id}">详情</button>
                                    </td>
                                </tr>
                            </volist>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div> 
</div>
<!-- 时间函数 -->
<script type="text/javascript">
    //时间戳转化函数
    function getMyDate(str) {
        var oDate = new Date(str),
        oYear = oDate.getFullYear(),
        oMonth = oDate.getMonth() + 1,
        oDay = oDate.getDate(),
        oHour = oDate.getHours(),
        oMin = oDate.getMinutes(),
        oSen = oDate.getSeconds(),
        oTime = oYear + '-' + getzf(oMonth) + '-' + getzf(oDay) ; //最后拼接时间  + ' ' + getzf(oHour) + ':' + getzf(oMin) + ':' + getzf(oSen) 
        return oTime;
    };
    //补0操作
    function getzf(num) {
        if (parseInt(num) < 10) {
            num = '0' + num;
        }
        return num;
    }
</script>
<!-- 详情跳转 -->
<script type="text/javascript">
    function xiangqing(obj) {
        var id = $(obj).attr('peopleId');
        add_tab('详细信息','/index.php/Home/Jmxxcx/gr_xiangxi/id/'+id);
    }
    function chexiangqing(obj) {
        var id = $(obj).attr('cheId');
        add_tab('车辆信息','/index.php/Home/Jmxxcx/cheDetail/id/'+id);
    }
    function danweixiangqing(obj) {
        var id = $(obj).attr('danweiId');
        add_tab('单位信息','/index.php/Home/Jmxxcx/danweiDetail/id/'+id);
    }
</script>
<!-- 无结果时执行 -->
<script type="text/javascript">
    // console.log({$data['name']});
    $(function(){
        if ({$count}==0) {
            var html_wujieguo = "";    
            html_wujieguo+='<p style="font-size:24px;color: #aaa;padding-top: 150px; display: flex;justify-content: center;">默认查询人无结果,您可以点击上方车,房,单位等标签进行查询</p>';
            $('#query_result').html(html_wujieguo);
        }
    });
</script>
<!-- 三元运算逻辑 -->
<script type="text/javascript">
    var sex = document.getElementsByClassName("sex");
    for(var i=0; i<sex.length;i++ ){
        if (sex[i].innerHTML==0) {
            sex[i].innerHTML = "女";
        }else{
            sex[i].innerHTML = "男";
        }
    }
   
    var zhongdian = document.getElementsByClassName("zhongdian");
    for(var j=0; j<zhongdian.length;j++ ){
        if (zhongdian[j].innerHTML==0) {
            zhongdian[j].innerHTML = "否";
        }else{
            zhongdian[j].innerHTML = "是";
        }
    }
</script>
<!-- 页面搜索按钮被点击 -->
<script type="text/javascript">
    $('#chaxunanniu').on('click',function(){
        //非全空验证
        var skeyword = document.getElementById("skeyword").value;
        if (skeyword=="") {
            alert("请至少输入一个查询条件");
            return false;
        }
        // edit_tab(skeyword+'的搜索结果');
        var dataa={
            skeyword:skeyword,
        }         
        //返回结果
        $.post("__MODULE__/Jmxxcx/ren_easyqry",dataa,function(res){
            var data = JSON.parse(res);
            // console.log(data);
            var html_ren = "";
            if (data != 0) {
                html_ren+='<table class="layui-table"><colgroup><col width="150"><col width="60"><col width="106"><col width="175"><col width="60"><col width="88"><col width="160"><col width="94"></colgroup><thead style="width:100%;"><tr><th>姓名</th><th>性别</th><th>出生日期</th><th>身份证号</th><th>民族</th><th>婚姻状况</th><th>是否重点人</th><th>详情</th></tr></thead><tbody style="width:100%;">';
                for(let i = 0;i < data.length;i++){
                    // console.log(data[i]['cheid']);
                    html_ren+=`<tr><td>${data[i]['name']}</td><td>${data[i]['sex']==1?'男':'女'}</td><td>${data[i]['date']}</td><td>${data[i]['idcard']}</td><td>${data[i]['minzu']}</td><td style="text-align:center;">${data[i]['hunyin']}</td><td style="text-align:center;">${data[i]['is_zhongdian']==1?'是':'否'}</td><td><button class="layui-btn layui-btn-sm btn-primary" style="color: white;"  onclick="xiangqing(this)" peopleId="${data[i]['id']}">详情</button></td></tr>`;
                }
                html_ren+='</tbody></table>';
            } 
            else{
                var html_wujieguo = "";    
                html_wujieguo+='<p style="font-size:24px;color: #aaa;padding-top: 150px; display: flex;justify-content: center;">默认查询人无结果,您可以点击上方车,房,单位等标签进行查询</p>';
                $('#query_result').html(html_wujieguo);
            }
            $('#query_result').html(html_ren);
        });
    });     
</script>
<!-- 点击人标签 -->
<script type="text/javascript">
    $('.ren_dianji').on('click',function(){
        //增加数据库中人标签被点击的次数
        var id = {$user.id};
        var datab={
            id:id,
        }  
        $.post("__MODULE__/Jmxxcx/ren_ciadd",datab,function(res){
            
        });

        //非全空验证
        var skeyword = document.getElementById("skeyword").value;
        if (skeyword=="") {
            alert("请至少输入一个查询条件");
            return false;
        }
        var dataa={
            skeyword:skeyword,
        }         
        //返回结果
        $.post("__MODULE__/Jmxxcx/ren_easyqry",dataa,function(res){
            var data = JSON.parse(res);
            var html_ren = "";
            if (data != 0) {
                html_ren+='<table class="layui-table"><colgroup><col width="150"><col width="60"><col width="106"><col width="175"><col width="60"><col width="88"><col width="160"><col width="94"></colgroup><thead style="width:100%;"><tr><th>姓名</th><th>性别</th><th>出生日期</th><th>身份证号</th><th>民族</th><th>婚姻状况</th><th>是否重点人</th><th>详情</th></tr></thead><tbody style="width:100%;">';
                for(let i = 0;i < data.length;i++){
                    // console.log(data[i]['cheid']);
                    html_ren+=`<tr><td>${data[i]['name']}</td><td>${data[i]['sex']==1?'男':'女'}</td><td>${data[i]['date']}</td><td>${data[i]['idcard']}</td><td>${data[i]['minzu']}</td><td style="text-align:center;">${data[i]['hunyin']}</td><td style="text-align:center;">${data[i]['is_zhongdian']==1?'是':'否'}</td><td><button class="layui-btn layui-btn-sm btn-primary" style="color: white;"  onclick="xiangqing(this)" peopleId="${data[i]['id']}">详情</button></td></tr>`;
                }
                html_ren+='</tbody></table>';
                $('#query_result').html(html_ren);
            } 
            else{
                var html_wujieguo = "";    
                html_wujieguo+='<p style="font-size:24px;color: #aaa;padding-top: 150px; display: flex;justify-content: center;">默认查询人无结果,您可以点击上方车,房,单位等标签进行查询</p>';
                $('#query_result').html(html_wujieguo);
            }
        });
    });  
</script>
<!-- 车标签被点击 -->
<script type="text/javascript">
    $('.che_dianji').on('click',function(){
        //增加数据库中车标签被点击的次数
        var id = {$user.id};
        var datab={
            id:id,
        }  
        $.post("__MODULE__/Jmxxcx/che_ciadd",datab,true);

        //非全空验证
        var skeyword = document.getElementById("skeyword").value;
        if (skeyword=="") {
            alert("请至少输入一个查询条件");
            return false;
        }
        var dataa={
            skeyword:skeyword,
        }         
        //返回结果
        $.post("__MODULE__/Jmxxcx/che_easyqry",dataa,function(res){
            var data = JSON.parse(res);
            // console.log(data);
            var html_ren = "";
            if (data != 0) {
                html_ren+='<table class="layui-table"><colgroup><col width="110"><col width="100"><col width="88"><col width="150"><col width="130"><col width="110"><col width="88"><col width="130"><col width="120"></colgroup><thead><tr><th>车牌号</th><th>车主</th><th>车颜色</th><th>车型</th><th>注册日期</th><th>使用性质</th><th>发动机号</th><th>发证日期</th><th>详情</th></tr></thead><tbody>';
                for(let i = 0;i < data.length;i++){
                    // console.log(data[i]['cheid']);
                    html_ren+=`<tr id="${data[i]['cheid']}"><td>${data[i]['che_number']}</td><td>${data[i]['name']}</td><td>${data[i]['color']}</td><td>${data[i]['type']}</td><td>${getMyDate(data[i]['register_time']*1000)}</td><td>${data[i]['use_xingzhi']}</td><td>${data[i]['engine_num']}</td><td>${getMyDate(data[i]['fazheng_time']*1000)}</td><td><button class="layui-btn layui-btn-sm btn-primary" style="color: white;"  onclick="chexiangqing(this)" cheId="${data[i]['id']}">详情</button></td></tr>`;
                }
                html_ren+='</tbody></table>';
                $('#query_result').html(html_ren);
            } 
            else{
                var html_wujieguo = "";    
                html_wujieguo+='<p style="font-size:24px;color: #aaa;padding-top: 150px; display: flex;justify-content: center;">默认查询车无结果,您可以点击上方人,房,单位等标签进行查询</p>';
                $('#query_result').html(html_wujieguo);
            }
        });
    });  
</script>
<!-- 房标签被点击 -->
<script type="text/javascript">
    $('.fang_dianji').on('click',function(){
        //增加数据库中房标签被点击的次数
        var id = {$user.id};
        var datab={
            id:id,
        }  
        $.post("__MODULE__/Jmxxcx/fang_ciadd",datab,true);

        //非全空验证
        var skeyword = document.getElementById("skeyword").value;
        if (skeyword=="") {
            alert("请至少输入一个查询条件");
            return false;
        }
        var dataa={
            skeyword:skeyword,
        }         
        //返回结果
        $.post("__MODULE__/Jmxxcx/che_easyqry",dataa,function(res){
            var data = JSON.parse(res);
            // console.log(data);
            var html_ren = "";
            if (data != 0) {
                html_ren+='<table class="layui-table"><colgroup><col width="110"><col width="100"><col width="88"><col width="150"><col width="130"><col width="110"><col width="88"><col width="130"><col width="120"></colgroup><thead><tr><th>车牌号</th><th>车主</th><th>车颜色</th><th>车型</th><th>注册日期</th><th>使用性质</th><th>发动机号</th><th>发证日期</th><th>详情</th></tr></thead><tbody>';
                for(let i = 0;i < data.length;i++){
                    // console.log(data[i]['cheid']);
                    html_ren+=`<tr id="${data[i]['cheid']}"><td>${data[i]['che_number']}</td><td>${data[i]['name']}</td><td>${data[i]['color']}</td><td>${data[i]['type']}</td><td>${getMyDate(data[i]['register_time']*1000)}</td><td>${data[i]['use_xingzhi']}</td><td>${data[i]['engine_num']}</td><td>${getMyDate(data[i]['fazheng_time']*1000)}</td><td><button class="layui-btn layui-btn-sm btn-primary" style="color: white;"  onclick="chexiangqing(this)" cheId="${data[i]['id']}">详情</button></td></tr>`;
                }
                html_ren+='</tbody></table>';
                $('#query_result').html(html_ren);
            } 
            else{
                var html_wujieguo = "";    
                html_wujieguo+='<p style="font-size:24px;color: #aaa;padding-top: 150px; display: flex;justify-content: center;">默认查询房无结果,您可以点击上方人,车,单位等标签进行查询</p>';
                $('#query_result').html(html_wujieguo);
            }
        });
    });  
</script>
<!-- 单位标签被点击 -->
<script type="text/javascript">
    $('.danwei_dianji').on('click',function(){
        //增加数据库中单位标签被点击的次数
        var id = {$user.id};
        var datab={
            id:id,
        }  
        $.post("__MODULE__/Jmxxcx/danwei_ciadd",datab,true);
        //非全空验证
        var skeyword = document.getElementById("skeyword").value;
        if (skeyword=="") {
            alert("请至少输入一个查询条件");
            return false;
        }
        var dataa={
            skeyword:skeyword,
        }         
        //返回结果
        $.post("__MODULE__/Jmxxcx/danwei_easyqry",dataa,function(res){
            var data = JSON.parse(res);
            // console.log(data);
            var html_ren = "";
            if (data != 0) {
                html_ren+='<table class="layui-table"><colgroup><col><col><col><col><col><col><col><col width="88"></colgroup><thead><tr><th>单位编码</th><th>单位名称</th><th>所在地地址</th><th>经纬度</th><th>法人名</th><th>法人身份证号</th><th>保卫负责人</th><th>详情</th></tr></thead><tbody>';
                for(let i = 0;i < data.length;i++){
                    // console.log(data[i]['cheid']);
                    html_ren+=`<tr id="${data[i]['danwei_id']}" onclick='danweigailan(this)'><td>${data[i]['bianma']}</td><td>${data[i]['workname']}</td><td>${data[i]['location']}</td><td>(${data[i]['longitude']},${data[i]['latitude']})</td><td>${data[i]['faren_name']}</td><td>${data[i]['faren_idcard']}</td><td>${data[i]['baowei_name']}</td><td><button class="layui-btn layui-btn-sm btn-primary" style="color: white;"  onclick="danweixiangqing(this)" danweiId="${data[i]['id']}">详情</button></td></tr>`;
                }
                html_ren+='</tbody></table>';
                $('#query_result').html(html_ren);
            } 
            else{
                var html_wujieguo = "";    
                html_wujieguo+='<p style="font-size:24px;color: #aaa;padding-top: 150px; display: flex;justify-content: center;">本次查询单位无结果,您可以点击上方人,房,车等标签进行查询</p>';
                $('#query_result').html(html_wujieguo);
            }
        });
    });  
</script>

